package com.jgame.secondarymarket.interfaces.api.account;

import com.jgame.secondarymarket.application.service.account.AccountApplicationService;
import com.jgame.secondarymarket.infrastructure.common.model.response.Result;
import com.jgame.secondarymarket.interfaces.dto.account.AccountDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @title: AccountApi
 * @Author Wangsj
 * @Date: 2021/7/16
 */

@Slf4j
@RestController
@RequestMapping("account")
@Api(tags = {"用户接口"})
public class AccountApi {

    @Autowired
    AccountApplicationService accountApplicationService;


    @ApiOperation(value = "新增用户")
    @PostMapping
    public Result save(@Valid @RequestBody AccountDTO account) {
        return Result.op(() -> accountApplicationService.save(account));
    }

}
